package com.hiwhitley.easy.day07;

/**
 * Created by hiwhitley on 2016/8/11.
 */
public class AddDigits {
    public static int addDigits(int num) {
        int a = num % 10;
        int b = num / 10;
        if (b == 0)
            return a;
        return addDigits(a + b);
    }

    public static void main(String[] args) {
        System.out.println(addDigits(38));
    }
}
